package com.klhappy.houyuan.dialog;

import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.klhappy.houyuan.R;

/**
 * Created by MrPu on 15/11/29.
 */
public class Photograph implements View.OnClickListener{

    private Dialog dialog;

    public Photograph(Context context){
        View view = LayoutInflater.from(context).inflate(R.layout.photo_graph ,null);
        Button camera = (Button) view.findViewById(R.id.item_camera);
        Button photo = (Button) view.findViewById(R.id.item_Photo);
        Button cancel = (Button) view.findViewById(R.id.item_cancel);

        camera.setOnClickListener(this);
        photo.setOnClickListener(this);
        cancel.setOnClickListener(this);

        dialog = new Dialog(context ,R.style.Dialog_Fullscreen);
        dialog.setContentView(view);
    }

    public void show(){
        dialog.show();
    }

    public void dimiss(){
        if (dialog.isShowing()){
            dialog.dismiss();
        }
    }
    public void doGoToImg() {}

    public void doGoToPhone() {}

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.item_camera:
                Log.d("mao", "相机");
                doGoToPhone();
                break;
            case R.id.item_Photo:
                Log.d("mao", "相册");
                doGoToImg();
                break;
            case R.id.item_cancel:
                dimiss();
                break;
            case R.id.parent:
                dimiss();
                break;
            default:
                break;
        }
    }
}
